home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / TSPA3460 / TSUNTJ.INT < prev    next >
Text File  |  1994-08-16  |  5KB  |  127 lines

  1. (*
  2. Timo Salmi UNiT J
  3. A Turbo Pascal unit of file information and handling etc
  4. All rights reserved 24-Nov-91, 6-Dec-92, 19-Aug-92, 7-Nov-92, 30-Jun-93
  5.                     16-Aug-93, 28-Nov-93
  6.  
  7. In the 24-Nov-91 update of USUNTH unit part of its routines were
  8. transferred here to TSUTNTJ. The transferred routines were
  9.   COPYFILE Copy a file from within a Turbo Pascal program
  10.   ISDIRFN  Is a name a directory or not
  11.   OPENEDFN Is an assigned textfile still open or not
  12.   PIPEDIFN Is the standard input from redirection
  13.   PIPEDNFN Is the standard output redirected to nul
  14.   PIPEDOFN Is the standard output redirected
  15.  
  16. This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
  17. NON-INSTITUTIONAL purposes, provided it is not changed in any way, and
  18. that a proper attribution is made. For ANY other usage, such as use in a
  19. business enterprise or at a university, contact the author for the terms
  20. of registration.
  21.  
  22. The units are under development. Comments and contacts are solicited. If
  23. you have any questions, please do not hesitate to use electronic mail for
  24. communication.
  25. InterNet address: ts@uwasa.fi
  26.  
  27. The author shall not be liable to the user for any direct, indirect or
  28. consequential loss arising from the use of, or inability to use, any unit,
  29. program or file howsoever caused. No warranty is given that the units and
  30. programs will work under all circumstances.
  31.  
  32. Timo Salmi
  33. Professor of Accounting and Business Finance
  34. Faculty of Accounting & Industrial Management; University of Vaasa
  35. P.O. BOX 297, FIN-65101 Vaasa, Finland
  36. *)
  37.  
  38. unit TSUNTJ;
  39.  
  40. (* ======================================================================= *)
  41.                           interface
  42. (* ======================================================================= *)
  43.  
  44. uses Dos
  45. {$IFDEF VER40}
  46.      ,TSUNT45
  47. {$ENDIF}
  48.      ;
  49.  
  50. (* ====================================================================
  51.                    File status information
  52.    ==================================================================== *)
  53.  
  54. (* This function returns whether a name is a directory or not.
  55.    Avoid using this on an open file or standard devices.
  56.    PathStr is a predefined Turbo Pascal string type String[79].
  57.    See FAQPAS2.TXT in garbo.uwasa.fi:/pc/ts/tsfaqp*.zip for more
  58.    on the ISDIRFN functions *)
  59. function ISDIRFN (name : PathStr) : boolean;
  60.  
  61. (* This function returns whether a name is a directory or not.
  62.    Avoid using this on an open file or standard devices.
  63.    An alternative method *)
  64. function ISDIR2FN (name : string) : boolean;
  65.  
  66. (* Another alternative method for testing whether a name is a directory.
  67.    This is based on listing all the directories on the relevant drive,
  68.    and seeing whether the given name is found among them.
  69.    No leading or traling blanks or tabs are allowed in the name.
  70.    This is not very efficient, but it is robust, and instructive *)
  71. function ISDIR3FN (name : string) : boolean;
  72.  
  73. (* This function returns whether a text file is open or closed.
  74.                                    ^^^^
  75.    Naturally the FilePointer must have been assigned at an earlier stage.
  76.    Very convenient as a test in routines which close a file.
  77.    e.g. use: if OPENEDFN(f) then close(f);                                *)
  78. function OPENEDFN (var FilePointer : text) : boolean;
  79.  
  80. (* This function returns whether a non-text file is open or closed. *)
  81. function OPENFLFN (var FilePointer : file) : boolean;
  82.  
  83. (* Is the standard input from redirection. Based on PC-Mag Vol 10 No 7, 374,
  84.    Duncan 412, Dettmann 602-603 *)
  85. function PIPEDIFN : boolean;
  86.  
  87. (* Is the standard output redirected. Based on PC-Mag Vol 10 No 7, 374,
  88.    Duncan 412, Dettmann 602-603 *)
  89. function PIPEDOFN : boolean;
  90.  
  91. (* Is the standard output redirected to nul. Based on PC-Mag Vol 10 No 7, 374,
  92.    Duncan 412, Dettmann 602-603 *)
  93. function PIPEDNFN : boolean;
  94.  
  95. (* ====================================================================
  96.                    Program information
  97.    ==================================================================== *)
  98.  
  99. (* Show the memory address where the interrupt is located *)
  100. procedure INTRLOCA (IntrNumber  : byte;
  101.                     var segment : word;
  102.                     var offset  : word);
  103.  
  104. (* Show the memory address to which the interrupt points *)
  105. procedure INTRADDR (IntrNumber  : byte;
  106.                     var segment : word;
  107.                     var offset  : word);
  108.  
  109. (* ====================================================================
  110.                       Perform tasks
  111.    ==================================================================== *)
  112.  
  113. (* Copy a file (of any type)
  114.    Status codes:
  115.    0 : ok
  116.    1 : FromFile does not exits
  117.    2 : ToFile already exists
  118.    3 : ToFile cannot be opened for writing (read-only,
  119.          write protected, invalid device)
  120.    4 : Error in writing to ToFile
  121.    5 : Copy error (disk probably full)
  122.    6 : Date stamp error
  123.    7 : Out of memory
  124. *)
  125. procedure COPYFILE (FromFile, ToFile : string; var status : byte);
  126.  
  127.